home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / Libraries / C Internet Config / IC Application Source ƒ / IC Resource ƒ / IC Headers ƒ / IC Component API Descriptions.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-11-17  |  22.2 KB  |  404 lines  |  [TEXT/SPM ]

  1. /*
  2.     Component Interface.h
  3.     
  4.     Describes the component interface routines and their parameters.
  5.     
  6.     Important note about naming conventions:  Read the file "API Readme.h" to understand
  7.     the prefixes used in all of the calls...
  8. */
  9.  
  10. #if 0 // don't include into compilation of code
  11.  
  12. /* ***** Starting Up and Shutting Down ***** */
  13.  
  14. pascal ICError ICCStart(internetConfigurationComponent *inst, OSType creator);
  15. /*
  16.     Call this at application initialisation. Set creator to your application
  17.     creator to allow for future expansion of the IC system. Returns
  18.     inst as a connection to the IC system.
  19. */
  20.  
  21. pascal ICError ICCStop(internetConfigurationComponent inst);
  22. /*
  23.     It is illegal to call this routine inside a ICBegin/End pair.
  24.     
  25.     Call this at application initialisation, after which inst
  26.     is no longer valid connection to IC.
  27. */
  28.  
  29. /* ***** Specifying a Configuration ***** */
  30.  
  31. pascal ICError ICCFindConfigFile(internetConfigurationComponent inst, short count, ICDirSpecArrayPtr folders);
  32. /*
  33.     It is illegal to call this routine inside a ICBegin/End pair.
  34.     
  35.     Call to configure this connection to IC.
  36.     Set count as the number of valid elements in folders.
  37.     Set folders to a pointer to the folders to search.
  38.     Setting count to 0 and folders to nil is OK.
  39.     Searches the specified folders and then the Preferences folder
  40.     in a unspecified manner.
  41. */
  42.  
  43. pascal ICError ICCFindUserConfigFile(internetConfigurationComponent inst, ICDirSpec *where)
  44. /*
  45.     Requires IC 1.1.
  46.     
  47.     It is illegal to call this routine inside a ICBegin/End pair.
  48.     
  49.     Similar to ICFindConfigFile except that it only searches the folder
  50.     specified in where.  If the input parameters are valid the routine
  51.     will always successful configure the instance, creating an
  52.     empty configuration if necessary
  53.     For use with double-clickable preference files.
  54. */
  55.  
  56. pascal ICError ICCGeneralFindConfigFile(internetConfigurationComponent inst, Boolean search_prefs, Boolean can_create,
  57.         short count, ICDirSpecArrayPtr folders)
  58. /*
  59.     Requires IC 1.2.
  60.     
  61.     It is illegal to call this routine inside a ICBegin/End pair.
  62.     
  63.     Call to configure this connection to IC.
  64.     This routine acts as a more general replacement for
  65.     ICFindConfigFile and ICFindUserConfigFile.
  66.     Set search_prefs to true if you want it to search the preferences folder.
  67.     Set can_create to true if you want it to be able to create a new config.
  68.     Set count as the number of valid elements in folders.
  69.     Set folders to a pointer to the folders to search.
  70.     Setting count to 0 and folders to nil is OK.
  71.     Searches the specified folders and then optionally the Preferences folder
  72.     in a unspecified manner.
  73. */
  74.  
  75. pascal ICError ICCChooseConfig(internetConfigurationComponent inst)
  76. /*
  77.     Requires IC 1.2.
  78.     
  79.     It is illegal to call this routine inside a ICBegin/End pair.
  80.     
  81.     Requests the user to choose a configuration, typically using some
  82.     sort of modal dialog. If the user cancels the dialog the configuration
  83.     state will be unaffected.
  84. */
  85.  
  86. pascal ICError ICCChooseNewConfig(internetConfigurationComponent inst)
  87. /*
  88.     Requires IC 1.2.
  89.     
  90.     It is illegal to call this routine inside a ICBegin/End pair.
  91.     
  92.     Requests the user to create a new configuration, typically using some
  93.     sort of modal dialog. If the user cancels the dialog the configuration
  94.     state will be unaffected.
  95. */
  96.  
  97. pascal ICError ICCGetConfigName(internetConfigurationComponent inst, Boolean longname, Str255 name)
  98. /*
  99.     Requires IC 1.2.
  100.     
  101.     You must specify a configuration before calling this routine.
  102.     Returns a string that describes the current configuration at a user
  103.     level. Set longname to true if you want a long name, up to 255
  104.     characters, or false if you want a short name, typically about 32
  105.     characters.
  106.     The returned string is for user display only. If you rely on the
  107.     exact format of it, you will conflict with any future IC
  108.     implementation that doesn't use explicit preference files.
  109. */
  110.  
  111. pascal ICError ICCGetConfigReference(internetConfigurationComponent inst, ICConfigRefHandle ref)
  112. /*
  113.     Requires IC 1.2.
  114.     
  115.     You must specify a configuration before calling this routine.
  116.     Returns a self-contained reference to the instance's current
  117.     configuration.
  118.     ref must be a valid non-nil handle and it will be resized to fit the
  119.     resulting data.
  120. */
  121.  
  122. pascal ICError ICCSetConfigReference(internetConfigurationComponent inst, ICConfigRefHandle ref, long flags)
  123. /*
  124.     Requires IC 1.2.
  125.     
  126.     It is illegal to call this routine inside a ICBegin/End pair.
  127.     
  128.     Reconfigures the instance using a configuration reference that was
  129.     got using ICGetConfigReference reference. Set the
  130.     icNoUserInteraction_bit in flags if you require that this routine
  131.     not present a modal dialog. Other flag bits are reserved and should
  132.     be set to zero.
  133.     ref must not be nil.
  134. */
  135.  
  136. pascal ICError ICCSpecifyConfigFile(internetConfigurationComponent inst, FSSpec *config)
  137. /*
  138.     It is illegal to call this routine inside a ICBegin/End pair.
  139.     
  140.     For use only by the IC application.
  141.     If you call this routine yourself, you will conflict with any
  142.     future IC implementation that doesn't use explicit preference files.
  143. */
  144.  
  145. /* ***** Getting Information ***** */
  146.  
  147. pascal ICError ICCGetSeed(internetConfigurationComponent inst, long *seed)
  148. /*
  149.     You do not have to specify a configuration before calling this routine.
  150.     You do not have to be inside an ICBegin/End pair to call this routine.
  151.     Returns the current seed for the IC prefs database.
  152.     This seed changes each time a non-volatile preference is changed.
  153.     You can poll this to determine if any cached preferences change.
  154. */
  155.  
  156. pascal ICError ICCGetPerm(internetConfigurationComponent inst, ICPerm *perm)
  157. /*
  158.     You do not have to specify a configuration before calling this routine.
  159.     Returns the access permissions currently associated with this instance.
  160.     While applications normally know what permissions they have,
  161.     this routine is designed for use by override components.
  162. */
  163.  
  164. pascal ICError ICCDefaultFileName(internetConfigurationComponent inst, Str63 name)
  165. /*
  166.     You do not have to specify a configuration before calling this routine.
  167.     You do not have to be inside an ICBegin/End pair to call this routine.
  168.     Returns the default file name for IC preference files.
  169.     Applications should never need to call this routine.
  170.     If you rely on information returned by this routine yourself,
  171.     you may conflict with any future IC implementation that doesn't use
  172.     explicit preference files.
  173.     The component calls this routine to set up the default IC file name.
  174.     This allows this operation to be intercepted by a component that has
  175.     captured us. It currently gets it from the component resource file.
  176.     The glue version is hardwired to "Internet Preferences".
  177. */
  178.  
  179. /* ***** Reading and Writing Preferences ***** */
  180.  
  181. pascal ICError ICCBegin(internetConfigurationComponent inst, ICPerm perm)
  182. /*
  183.     You must specify a configuration before calling this routine.
  184.     It is illegal to call this routine inside a ICBegin/End pair.
  185.     Starting reading or writing multiple preferences.
  186.     A call to this must be balanced by a call to ICEnd.
  187.     Do not call WaitNextEvent between these calls.
  188.     The perm specifies whether you intend to read or read/write.
  189.     Only one writer is allowed per instance.
  190.     Note that this may open resource files that are not closed
  191.     until you call ICEnd.
  192. */
  193.  
  194. pascal ICError ICCGetPref(internetConfigurationComponent inst, ConstStr255Param key, ICAttr *attr, Ptr buf, long *size)
  195. /*
  196.     You must specify a configuration before calling this routine.
  197.     If you are getting or setting multiple preferences, you should place
  198.     these calls within an ICBegin/ICEnd pair.
  199.     If you call this routine outside of such a pair, it implicitly
  200.     calls ICBegin(inst, icReadOnlyPerm).
  201.     Reads the preference specified by key from the IC database to the
  202.     buffer pointed to by buf and size.
  203.     key must not be the empty string.
  204.     If buf is nil then no data is returned.
  205.     size must be non-negative.
  206.     attr and size are always set on return. On errors (except icTruncatedErr)
  207.     attr is set to ICattr_no_change and size is set to 0.
  208.     size is the actual size of the data.
  209.     attr is set to the attributes associated with the preference.
  210.     If this routine returns icTruncatedErr then the other returned
  211.     values are valid except that only the first size bytes have been
  212.     return. size is adjusted to reflecount is set to 0.
  213. */
  214.  
  215. pascal ICError ICCGetIndPref(internetConfigurationComponent inst, long n, Str255 key)
  216. /*
  217.     You must specify a configuration before calling this routine.
  218.     You must be inside an ICBegin/End pair to call this routine.
  219.     Returns the key of the Nth preference.
  220.     n must be positive.
  221.     Returns icPrefNotFoundErr if n is greater than the total number of preferences.
  222.     If the routine returns an error, key is undefined.
  223. */
  224.  
  225. pascal ICError ICCDeletePref(internetConfigurationComponent inst, ConstStr255Param key)
  226. /*
  227.     You must specify a configuration before calling this routine.
  228.     You must be inside an ICBegin/End pair to call this routine.
  229.     Deletes the preference specified by key.
  230.     key must not be the empty string.
  231.     Returns icPrefNotFound if the preference specified by key is not present.
  232. */
  233.  
  234. pascal ICError ICCEnd(internetConfigurationComponent inst)
  235. /*
  236.     You must specify a configuration before calling this routine.
  237.     You must be inside an ICBegin/End pair to call this routine.
  238.     Terminates a preference session, as started by ICBegin.
  239.     You must have called ICBegin before calling this routine.
  240. */
  241.  
  242. /* ***** User Interface Stuff ***** */
  243.  
  244. pascal ICError ICCEditPreferences(internetConfigurationComponent inst, ConstStr255Param key)
  245. /*
  246.     Requires IC 1.1.
  247.     
  248.     You must specify a configuration before calling this routine.
  249.     You do not have to be inside an ICBegin/End pair to call this routine.
  250.     Instructs IC to display the user interface associated with editing
  251.     preferences and focusing on the preference specified by key.
  252.     If key is the empty string then no preference should be focused upon.
  253.     You must have specified a configuration before calling this routine.
  254.     You do not need to call ICBegin before calling this routine.
  255.     In the current implementation this launches the IC application
  256.     (or brings it to the front) and displays the window containing
  257.     the preference specified by key.
  258.     It may have a radically different implementation in future
  259.     IC systems.
  260. */
  261.  
  262. /* ***** URL Handling ***** */
  263.  
  264. pascal ICError ICCParseURL(internetConfigurationComponent inst, ConstStr255Param hint, Ptr data, long len,
  265.         long *selStart, long *selEnd, Handle url)
  266. /*
  267.     Requires IC 1.1.
  268.     
  269.     You must specify a configuration before calling this routine.
  270.     You do not have to be inside an ICBegin/End pair to call this routine.
  271.     Parses a URL out of the specified text and returns it in a canonical form
  272.     in a handle.
  273.     hint indicates the default scheme for URLs of the form "name@address".
  274.     If hint is the empty string then URLs of that form are not allowed.
  275.     data points to the start of the text. It must not be nil.
  276.     len indicates the length of the text. It must be non-negative.
  277.     selStart and selEnd should be passed in as the current selection of
  278.     the text. This selection is given in the same manner as TextEdit,
  279.     ie if selStart = selEnd then there is no selection only an insertion
  280.     point. Also selStart ≤ selEnd and 0 ≤ selStart ≤ len and 0 ≤ selEnd ≤ len.
  281.     selStart and selEnd are returned as the bounds of the URL. If the
  282.     routine returns an error then these new boundaries may be
  283.     invalid but they will be close.
  284.     The incoming url handle must not be nil.  The resulting URL is normalised
  285.     and copied into the url handle, which is resized to fit.
  286. */
  287.  
  288. pascal ICError ICCLaunchURL(internetConfigurationComponent inst, ConstStr255Param hint, Ptr data, long len,
  289.         long *selStart, long *selEnd)
  290. /*
  291.     Requires IC 1.1.
  292.     
  293.     You must specify a configuration before calling this routine.
  294.     You do not have to be inside an ICBegin/End pair to call this routine.
  295.     Parses a URL out of the specified text and feeds it off to the
  296.     appropriate helper.
  297.     hint indicates the default scheme for URLs of the form "name@address".
  298.     If hint is the empty string then URLs of that form are not allowed.
  299.     data points to the start of the text. It must not be nil.
  300.     len indicates the length of the text. It must be non-negative.
  301.     selStart and selEnd should be passed in as the current selection of
  302.     the text. This selection is given in the same manner as TextEdit,
  303.     ie if selStart = selEnd then there is no selection only an insertion
  304.     point. Also selStart ≤ selEnd and 0 ≤ selStart ≤ len and 0 ≤ selEnd ≤ len.
  305.     selStart and selEnd are returned as the bounds of the URL. If the
  306.     routine returns an error then these new boundaries may be
  307.     invalid but they will be close.
  308.     The URL is parsed out of the text and passed off to the appropriate
  309.     helper using the GURL AppleEvent.
  310. */
  311.  
  312. /* ***** Mappings Routines *****
  313.  * 
  314.  * Routines for interrogating mappings database.
  315.  * 
  316.  * ----- High Level Routines -----
  317.  */
  318.  
  319. pascal ICError ICCMapFilename(internetConfigurationComponent inst, ConstStr255Param filename, ICMapEntry *entry)
  320. /*
  321.     Requires IC 1.1.
  322.     
  323.     You must specify a configuration before calling this routine.
  324.     If you are getting or setting multiple preferences, you should place
  325.     these calls within an ICBegin/ICEnd pair.
  326.     If you call this routine outside of such a pair, it implicitly
  327.     calls ICBegin(inst, icReadWritePerm).
  328.     Takes the name of an incoming file and returns the most appropriate
  329.     mappings database entry, based on its extension.
  330.     filename must not be the empty string.
  331.     Returns icPrefNotFoundErr if no suitable entry is found.
  332. */
  333.  
  334. pascal ICError ICCMapTypeCreator(internetConfigurationComponent inst, OSType fType, OSType fCreator,
  335.         ConstStr255Param filename, ICMapEntry *entry)
  336. /*
  337.     Requires IC 1.1.
  338.     
  339.     You must specify a configuration before calling this routine.
  340.     You must be inside an ICBegin/End pair to call this routine.
  341.     Takes the type and creator (and optionally the name) of an outgoing
  342.     file and returns the most appropriate mappings database entry.
  343.     The filename may be either the name of the outgoing file or
  344.     the empty string.
  345.     Returns icPrefNotFoundErr if no suitable entry found.
  346. */
  347.  
  348. /* ----- Mid Level Routines ----- */
  349.  
  350. pascal ICError ICCMapEntriesFilename(internetConfigurationComponent inst, Handle entries, ConstStr255Param filename,
  351.         ICMapEntry *entry)
  352. /*
  353.     Requires IC 1.1.
  354.     
  355.     You must specify a configuration before calling this routine.
  356.     You do not have to be inside an ICBegin/End pair to call this routine.
  357.     Takes the name of an incoming file and returns the most appropriate
  358.     mappings database entry, based on its extension.
  359.     entries must be a handle to a valid IC mappings database preference.
  360.     filename must not be the empty string.
  361.     Returns icPrefNotFoundErr if no suitable entry is found.
  362. */
  363.  
  364. pascal ICError ICCMapEntriesTypeCreator(internetConfigurationComponent inst, Handle entries, OSType fType, OSType fCreator,
  365.         ConstStr255Param filename, ICMapEntry *entry)
  366. /*
  367.     Requires IC 1.1.
  368.     
  369.     You must specify a configuration before calling this routine.
  370.     You do not have to be inside an ICBegin/End pair to call this routine.
  371.     Takes the type and creator (and optionally the name) of an outgoing
  372.     file and returns the most appropriate mappings database entry.
  373.     entries must be a handle to a valid IC mappings database preference.
  374.     The filename may be either the name of the outgoing file or
  375.     the empty string.
  376.     Returns icPrefNotFoundErr if no suitable entry found.
  377. */
  378.  
  379. /* ----- Low Level Routines ----- */
  380.  
  381. pascal ICError ICCCountMapEntries(internetConfigurationComponent inst, Handle entries, long *count)
  382. /*
  383.     Requires IC 1.1.
  384.     
  385.     You must specify a configuration before calling this routine.
  386.     You do not have to be inside an ICBegin/End pair to call this routine.
  387.     Counts the number of entries in the mappings database.
  388.     entries must be a handle to a valid IC mappings database preference.
  389.     count is set to the number of entries.
  390. */
  391.  
  392. pascal ICError ICCGetIndMapEntry(internetConfigurationComponent inst, Handle entries, long ndx, long *pos, ICMapEntry *entry)
  393. /*
  394.     Requires IC 1.1.
  395.     
  396.     You must specify a configuration before calling this routine.
  397.     You do not have to be inside an ICBegin/End pair to call this routine.
  398.     Gets the ndx'th entry in the mappings database.
  399.     entries must be a handle to a valid IC mappings database preference.
  400.     ndx must be in the range from 1 to the number of entries in the database.
  401.     The value of pos is ignored on input. pos is set to the position of
  402.     the ndx'th entry in the database and is suitable for passing back
  403.     into ICSetMapEntry.
  404.     Does not retu